package com.ruoyi.system.controller;

import java.util.List;
import java.io.IOException;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.SysSettleDeposit;
import com.ruoyi.system.service.ISysSettleDepositService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 入驻保证金信息Controller
 * 
 * @author ruoyi
 * @date 2025-10-29
 */
@RestController
@RequestMapping("/deposit")
public class SysSettleDepositController extends BaseController
{
    @Autowired
    private ISysSettleDepositService sysSettleDepositService;

    /**
     * 查询入驻保证金信息列表
     */
    @RequiresPermissions("system:deposit:list")
    @GetMapping("/list")
    public TableDataInfo list(SysSettleDeposit sysSettleDeposit)
    {
        startPage();
        List<SysSettleDeposit> list = sysSettleDepositService.selectSysSettleDepositList(sysSettleDeposit);
        return getDataTable(list);
    }

    /**
     * 导出入驻保证金信息列表
     */
    @RequiresPermissions("system:deposit:export")
    @Log(title = "入驻保证金信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysSettleDeposit sysSettleDeposit)
    {
        List<SysSettleDeposit> list = sysSettleDepositService.selectSysSettleDepositList(sysSettleDeposit);
        ExcelUtil<SysSettleDeposit> util = new ExcelUtil<SysSettleDeposit>(SysSettleDeposit.class);
        util.exportExcel(response, list, "入驻保证金信息数据");
    }

    /**
     * 获取入驻保证金信息详细信息
     */
    @RequiresPermissions("system:deposit:query")
    @GetMapping(value = "/{settleDepositId}")
    public AjaxResult getInfo(@PathVariable("settleDepositId") Long settleDepositId)
    {
        return success(sysSettleDepositService.selectSysSettleDepositBySettleDepositId(settleDepositId));
    }

    /**
     * 新增入驻保证金信息
     */
    @RequiresPermissions("system:deposit:add")
    @Log(title = "入驻保证金信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysSettleDeposit sysSettleDeposit)
    {
        return toAjax(sysSettleDepositService.insertSysSettleDeposit(sysSettleDeposit));
    }

    /**
     * 修改入驻保证金信息
     */
    @RequiresPermissions("system:deposit:edit")
    @Log(title = "入驻保证金信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysSettleDeposit sysSettleDeposit)
    {
        return toAjax(sysSettleDepositService.updateSysSettleDeposit(sysSettleDeposit));
    }

    /**
     * 删除入驻保证金信息
     */
    @RequiresPermissions("system:deposit:remove")
    @Log(title = "入驻保证金信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{settleDepositIds}")
    public AjaxResult remove(@PathVariable Long[] settleDepositIds)
    {
        return toAjax(sysSettleDepositService.deleteSysSettleDepositBySettleDepositIds(settleDepositIds));
    }
}
